package com.cg.cgms.mapper;


import com.cg.cgms.pojo.User;
import com.cg.cgms.pojo.UserLove;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.ArrayList;


@Mapper
public interface UserMapper {
    //根据openid查询用户
    @Select("select * from user where openid=#{openid}")
    User FindByOpenid(String openid);
    //添加
    @Insert("insert into user (openid,createTime)" +
            " values (#{openid},now())")
    void add(String openid);
    @Insert("insert into userlvoe (openid,ssid)" +
            "values (#{openid},#{ssid})")
    void addCollect(String openid, Integer ssid);
    @Select("select * from userlvoe where openid=#{openid} and ssid=#{ssid}")
    UserLove findlove(String openid, Integer ssid);
    @Delete("delete from userlvoe where openid=#{openid} and ssid=#{ssid}")
    void deleteCollect(String openid, Integer ssid);
    @Select("select ssid from userlvoe where openid=#{openid}")
    ArrayList<Integer> ssidByOpenid(String openid);
}
